package com.jing.shop.service.serviceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jing.shop.domain.dto.ProductAttributeCategoryDTO;
import com.jing.shop.domain.dto.ProductAttributeDTO;
import com.jing.shop.domain.vo.ProductAttributeCategoryVO;
import com.jing.shop.domain.vo.ProductAttributeVO;
import com.jing.shop.mapper.ProductAttributeMapper;
import com.jing.shop.service.ProductAttributeCategoryService;
import com.jing.shop.service.ProductAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductAttributeServiceImpl implements ProductAttributeService {

    @Autowired
    private ProductAttributeMapper attributeMapper;

    @Override
    public PageInfo<ProductAttributeVO> findAttributeList(ProductAttributeDTO productAttributeDTO) {
        PageHelper.startPage(productAttributeDTO.getPageNum(),productAttributeDTO.getPageSize());
        List<ProductAttributeVO> attributeList = attributeMapper.findAttributeList(productAttributeDTO);
        PageInfo<ProductAttributeVO> productAttributeVOPageInfo = new PageInfo<>(attributeList);
        return productAttributeVOPageInfo;
    }

    @Override
    public PageInfo<ProductAttributeVO> findAttrList(ProductAttributeDTO productAttributeDTO) {
        PageHelper.startPage(productAttributeDTO.getPageNum(),productAttributeDTO.getPageSize());
        List<ProductAttributeVO> attrList = attributeMapper.findAttrList(productAttributeDTO);
        PageInfo<ProductAttributeVO> productAttributeVOPageInfo = new PageInfo<>(attrList);
        return productAttributeVOPageInfo;
    }

    @Override
    public void addAttribute(ProductAttributeDTO productAttributeDTO) {
        attributeMapper.findAttributeList(productAttributeDTO);
    }

    @Override
    public void updateAttribute(ProductAttributeDTO productAttributeDTO) {
        attributeMapper.updateAttribute(productAttributeDTO);
    }

    @Override
    public void delAttribute(Integer[] Ids) {
        attributeMapper.delAttribute(Ids);
    }

}
